import { request, ResponsePageResult, type ResponseResult } from '@/service/base';
import { API_PREFIX } from '@/const/application.ts';

export function login(data: { userName: string; password: string }): ResponseResult {
  return request.post('/pub/v1/user/login', data);
}

export function queryGzhQrCode(sceneKey: string,inviteCode?:string): ResponseResult {
  return request.post('/pub/v1/user/gzh/qrcode',{sceneKey:sceneKey,inviteCode:inviteCode});
}

export function queryLoginStatus(sceneKey: string): ResponseResult {
  return request.get('/pub/v1/user/check/'+sceneKey);
}

export async function queryUserInfo(): ResponsePageResult {
  return request.get(API_PREFIX+'/user/info');
}

export async function userTransactionPage(params: { pageNum: number; pageSize: number; transactionType:number; }): ResponsePageResult {
  return request.post(API_PREFIX+'/user/transaction/page', params);
}

export async function queryInviteRecordPage(params: { pageNum: number; pageSize: number;  }): ResponsePageResult {
  return request.post(API_PREFIX+'/user/invite/page', params);
}